//
//  ComstorNavigationController.swift
//  StudyDY
//
//  Created by yinchangming on 2018/7/13.
//  Copyright © 2018年 yinchangming. All rights reserved.
//

import UIKit
/***
 隐藏NavigationBar 与tilte
 
 **/
class ComstorNavigationController: UINavigationController,UIGestureRecognizerDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // 1 获取系统的pop手势
        guard let systemGes =    interactivePopGestureRecognizer else {return}
        //2  获取手势添加到的view
        guard let   gesView = systemGes.view else {return}
        // 3 获取target与action
        let targets = systemGes.value(forKey: "_targets") as? [NSObject]
        guard let targetObj =   targets?.first else {return}
        guard let target =    targetObj.value(forKey: "target") else {return}
        let action = Selector(("handleNavigationTransition:"))
        //创建自己的手势
        let panGes=UIPanGestureRecognizer()
        gesView.addGestureRecognizer(panGes)
        panGes.addTarget(target, action: action)
        
    }
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        //隐藏底部的tabbar
        viewController.hidesBottomBarWhenPushed=true
        super.pushViewController(viewController, animated: animated)
    }
    
    
}
